package src.main.kotlin.day09


/**
 * 枚举类2
 *  枚举可以有属性，可以有函数
 */
fun main() {
    println(ClassEnumTest2.NORTH)
    //  其中一个枚举元素就是这个类的实例
    println(ClassEnumTest2.EAST is ClassEnumTest2)
    println(ClassEnumTest2.WEST.update(DataClass(10,20)))
}

enum class ClassEnumTest2(private val dataClass: DataClass){
    EAST(DataClass(1,0)),
    WEST(DataClass(-1,0)),
    SOUTH(DataClass(-1,0)),
    NORTH(DataClass(1,0));

    fun update(playerData:DataClass) =
        DataClass(playerData.x + dataClass.x,
            playerData.y+dataClass.y)
}

enum class ClassEnumTest3(val sex:String,val hobby:String){
    EAST("3","10")
}